import request from "@/utils/request.js";

/**
 *
 * 订单接口
 *
 */

/**
 * 订单详情
 * @param data
 * @returns {*}
 */
export function orderDetail(id) {
  return request.get(`/campus/orderInfo/app/${id}`);
}


/**
 * 待接单列表
 *
 */
export function orderList(data) {
  return request.get('/campus/orderInfo/app/page', data, {noAuth: true});
}

export function indexLimit(data) {
  return request.get('/campus/orderInfo/app/indexLimit', data, {noAuth: true});
}

/**
 * 活动订单
 * @param data
 * @returns {*}
 */
export function activityOrders(data) {
  return request.get('/campus/orderInfo/app/activityOrder', data, {noAuth: true});
}

/**
 * 创建订单
 * @param data
 * @returns {*}
 */
export function createOrder(data) {
  return request.post('/campus/orderInfo/app/createOrder', data, {noAuth: true});
}

/**
 * 配送单列表
 * @param data
 * @returns {*}
 */
export function takeOrderList(data) {
  return request.get('/campus/orderInfo/app/takeOrderList', data, {noAuth: true});
}

/**
 * 会员订单列表
 * @param data
 * @returns {*}
 */
export function memberOrderList(data) {
  return request.get('/campus/orderInfo/app/memberOrderList', data, {noAuth: true});
}

/**
 * 获取某个用户的订单
 * @param data
 * @returns {*}
 */
export function memberOrderById(memberId,params) {
  return request.get('/campus/orderInfo/app/memberOrderById/'+memberId, params, {noAuth: false});
}

/**
 * 接单
 * @param data {
 *   orderId:''
 * }
 * @returns {*}
 */
export function takeOrder(data) {
  return request.post('/campus/orderInfo/app/takeOrder', data, {noAuth: false});
}

/**
 * 取消并且退款
 * @param data {
 *   orderId:''
 * }
 * @returns {*}
 */
export function cancelOrder(data) {
  return request.post('/campus/orderInfo/app/cancel', data, {noAuth: false});
}


/**
 * 订单完成
 * @param data {
 *   orderId:''
 * }
 * @returns {*}
 */
export function doneOrder(data) {
  return request.post('/campus/orderInfo/app/done', data, {noAuth: false});
}


/**
 * 订单审核
 * @param data {
 *   orderId:''
 * }
 * @returns {*}
 */
export function auditOrder(data) {
  return request.post('/campus/orderInfo/app/publisherAudit', data, {noAuth: false});
}


/**
 * 订单状态数量
 * @param data {
 *   orderId:''
 * }
 * @returns {*}
 */
export function getStatusCount(data) {
  return request.get('/campus/orderInfo/app/getStatusCount', data, {noAuth: false});
}



export function getHistoryOrder(data) {
  return request.get('/campus/orderInfo/app/history', data, {noAuth: false});
}
